program lilypad;
const
  fi = 'lilypad.in';
  fo = 'lilypad.out';
  dx : array[1..8] of longint = (-2, -1, 1, 2, 2, 1, -1, -2);
  dy : array[1..8] of longint = (1, 2, 2, 1, -1, -2, -2, -1);
  max = 30;
  maxk = 5;
  oo = 1000000000;
type
  point = record
            x, y : longint;
          end;
  node = record
           x, y, z : longint;
         end;
var
  a : array[1..max, 1..max] of byte;
  c : array[1..max, 1..max] of longint;
  d : array[1..max, 1..max, 0..maxk] of longint;
  start, finish : point;
  n, m, l, r : longint;

procedure inp;
var
  i, j : longint;
begin
  read(m, n);
  for i := 1 to m do
    for j := 1 to n do
    begin
      read(a[i, j]);
      case a[i, j] of
        4 : with start do begin x := i; y := j; a[i, j] := 1; end;
        3 : with finish do begin x := i; y := j; a[i, j] := 1; end;
      end;
    end;
end;

procedure init;
begin
  fillchar(d, sizeof(d), 0);
  with start do d[x, y, 0] := 1;
end;

function inside(p : point) : boolean;
begin
  inside := (1 <= p.x) and (p.x <= m) and (1 <= p.y) and (p.y <= n);
end;

procedure find1;
var
  free : array[1..max, 1..max] of boolean;
  q : array[1..max*max] of point;
  i, j, temp : longint;
  u, v : point;
begin
  fillchar(free, sizeof(free), true);
  for i := 1 to m do
    for j := 1 to n do c[i, j] := oo;
  with start do c[x, y] := 0;
  with start do free[x, y] := false;
  l := 1;
  r := 1;
  q[1] := start;
  while l <= r do
  begin
    u := q[l];
    inc(l);
    free[u.x, u.y] := true;
    for i := 1 to 8 do
    begin
      v.x := u.x + dx[i];
      v.y := u.y + dy[i];
      if inside(v) and free[v.x, v.y] and (a[v.x, v.y] <> 2) then
      begin
        temp := c[u.x, u.y];
        if a[v.x, v.y] = 0 then inc(temp);
        if c[v.x, v.y] > temp then
        begin
          free[v.x, v.y] := false;
          c[v.x, v.y] := temp;
          inc(r);
          q[r] := v;
        end;
      end;
    end;
  end;
end;

procedure find2;
var
  free : array[1..max, 1..max, 1..maxk] of boolean;
  q : array[1..max*max*maxk] of node;
  i, j, temp : longint;
  l, r : longint;
begin
end;

procedure process;
begin
  find1;
  find2;
end;

procedure out;
begin
  with finish do
    writeln(c[x, y], ' ', d[x, y, c[x, y]]);
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);

  inp;
  process;
  out;

  close(output);
  close(input);
end.
